import { ApiProperty } from "@nestjs/swagger";
import { $Enums, User } from "@prisma/client";

export class UserVo implements Omit<User, "password" | "deletedAt"> {
    @ApiProperty()
    id: number;

    @ApiProperty()
    sn: string;

    @ApiProperty()
    email: string;

    @ApiProperty()
    username: string;

    @ApiProperty()
    nickname: string;

    @ApiProperty()
    avatar: string;

    @ApiProperty()
    realname: string;

    @ApiProperty()
    mobile: string;

    @ApiProperty()
    gender: $Enums.Gender;

    @ApiProperty()
    channel: $Enums.Channel;

    @ApiProperty()
    isDisabled: boolean;

    // @ApiProperty()
    isDeleted: boolean;

    @ApiProperty()
    isNew: boolean;

    @ApiProperty()
    lastLoginIp: string;

    @ApiProperty()
    lastLoginAt: Date;

    @ApiProperty()
    createdAt: Date;

    // @ApiProperty()
    updatedAt: Date;

    @ApiProperty()
    title: string;

    @ApiProperty()
    style: string;

    @ApiProperty()
    address: string;

    @ApiProperty()
    website: string;

    @ApiProperty()
    weibo: string;

    constructor(user: User) {
        this.id = user.id;
        this.sn = user.sn;
        this.email = user.email;
        this.username = user.username;
        this.nickname = user.nickname;
        this.avatar = user.avatar;
        this.realname = user.realname;
        this.mobile = user.mobile;
        this.gender = user.gender;
        this.channel = user.channel;
        this.isDisabled = user.isDisabled;
        // this.isDeleted = user.isDeleted;
        this.lastLoginIp = user.lastLoginIp;
        this.lastLoginAt = user.lastLoginAt;
        this.createdAt = user.createdAt;
        // this.updatedAt = user.updatedAt;

        this.title = user.title;
        this.style = user.style;
        this.address = user.address;
        this.website = user.website;
        this.weibo = user.weibo;
    }
}
